<script setup lang="ts">
import TitleCard from "@/components/titleCard.vue";
import CarouselTable from './CarouselTable.vue';
import Echart from './echart.vue';
import { onMounted, ref } from "vue";
import { pigIntestineList } from '../api/index'
//肝素钠台账图表
const tableData: any = ref([])
//猪小肠进出库台账
let fromData:any=ref({})
// 获取肝素钠总数据
const getPigIntestineList = async () => {
    let res: any = await pigIntestineList({})
    tableData.value = res.data.pigIntestines
    fromData.value=res.data
}
onMounted(() => {
    getPigIntestineList()
})
</script>

<template>
    <div class="right">
        <div class="rightItemTop">
            <TitleCard title="猪小肠进出库台账"></TitleCard>
            <div class="rightTop">
                <div class="item">
                    <img class="itemImg" src="../assets/img/cardIcon2.png" alt="">
                    <div class="contentItem">
                        <div class="name">采购数量（根）</div>
                        <div class="number">{{fromData.purchaseNum?fromData.purchaseNum:0}}</div>
                    </div>
                </div>

                <div class="item">
                    <img class="itemImg" src="../assets/img/cardIcon3.png" alt="">
                    <div class="contentItem">
                        <div class="name">出库数量（根）</div>
                        <div class="number">{{fromData.outboundNum?fromData.outboundNum:0}}</div>
                    </div>

                </div>


            </div>
            <CarouselTable class="CarouselTable" :headers="['采购日期', '采购数量', '出库数量']" :interval="2000"
                :tableData="tableData" :isBoolean="false" />
        </div>
        <div class=" echartsBox">
            <TitleCard title="数据类型统计"></TitleCard>
            <div class="echarts">
                <Echart></Echart>
            </div>
        </div>


    </div>
</template>

<style scoped lang="scss">
.right {
    display: flex;
    flex-direction: column;
    height: 100%;

    .rightItemTop {
        flex: 1;

        .rightTop {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 26px 0 30px;

            .item {
                width: 50%;
                display: flex;
                align-items: center;
                justify-items: center;

                .itemImg {
                    width: 50%;

                }

                .contentItem {
                    display: flex;
                    flex-direction: column;

                    .name {
                        font-size: 11px;
                        color: #36F8FF;
                    }

                    .number {
                        font-weight: bold;
                        font-size: 21px;
                        text-align: left;
                        padding-top: 7px;
                        color: #fff;

                    }

                }
            }

        }

        .CarouselTable {
            height: calc(100% - 210px);
            overflow-y: hidden;
        }
    }

    .echartsBox {
        height: 30% !important;

        .echarts {
            padding-top: 10px;
            box-sizing: border-box;
            height: 100%;
        }
    }
}
</style>
